<?php
/*
 Plugin Name: Skydrive Directlink
 Plugin URI: http://www.mathelite.cn/archives/wordpress-skydrive-outlink-plugin.html
 Version: 0.4.11
 Author: Flarefox
 Description: Auto update direct link of a skydrive file.
 Author URI: http://mathelite.cn/
 */
?>
<?php
/*
 Copyright 2009  FlareFox  (email : flarefox@163.com)

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
?>
<?php
$sddl_localversion="0.4.11";
$wp_sddl_plugin_url = trailingslashit( get_bloginfo('wpurl') ).PLUGINDIR.'/'. dirname( plugin_basename(__FILE__) );
$wp_sddl_plugin_path = ABSPATH . PLUGINDIR . '/'.dirname( plugin_basename(__FILE__) );
require_once( $wp_sddl_plugin_path . '/skydrive-directlink-class.php' );
$sddl = new skydrive_directlink_core();

// Add Options Page
add_action('admin_menu', 'sddl_add_pages');
function sddl_add_pages()
{
	add_options_page(__('Skydrive Directlink','skydrive-directlink'), __('Skydrive directlink','skydrive-directlink'), 'manage_options', 'skydrive-directlink/skydrive-directlink-options.php');
}

// textdomain
add_action('init', 'ffox_skydrive_directlink_textdomain');
function ffox_skydrive_directlink_textdomain(){
	load_plugin_textdomain('skydrive-directlink', false, 'skydrive-directlink');
}

// TO BE UPDATED
// Get the latest version number
function sddl_getinfo()
{
	return $sddl_localversion;
}


function skydrive_directlink($content) {
	global $sddl;
	return $sddl->direct_link_in_content($content);
}

$sddl_options = get_option('skydrive_directlink_options');
$priority = empty($sddl_options['hook_priority']) ? -1 : $sddl_options['hook_priority'];
add_filter('the_content', 'skydrive_directlink',$priority);
?>
